# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=perl-ev
pkgver=4.22
pkgrel=5
pkgdesc='perl interface to libev, a high performance full-featured event loop'
arch=('i686' 'x86_64')
license=('PerlArtistic' 'GPL')
options=('!emptydirs')
depends=('perl-common-sense')
makedepends=('perl-canary-stability')
url='https://metacpan.org/release/EV'
source=("http://search.cpan.org/CPAN/authors/id/M/ML/MLEHMANN/EV-$pkgver.tar.gz")
md5sums=('8bca55688edafcf98ab6d7a86ea195be')

build() {
  cd EV-$pkgver
  PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
  make
}

check() {
  cd EV-$pkgver
  make test
}

package() {
  cd EV-$pkgver
  make install DESTDIR="$pkgdir"
# template start; name=perl-binary-module-dependency; version=1;
if [[ $(find "$pkgdir/usr/lib/perl5/" -name "*.so") ]]; then
	_perlver_min=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);')
	_perlver_max=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]+1);')
	depends+=("perl>=$_perlver_min" "perl<$_perlver_max")
fi
# template end;
}
